package com.comall.dc.banktest.infrastructure.core;

public enum BalanceOperationEnum {

    DEPOSIT(0, "存款"),
    DRAW(1, "取款"),
    TRANSFER(2, "转账");

    private Integer operation;

    private String name;

    private BalanceOperationEnum(Integer operation, String name){
        this.operation = operation;
        this.name = name;
    }

    public Integer getOperation() {
        return operation;
    }

    public String getName() {
        return name;
    }

    public static BalanceOperationEnum of(Integer operation){
        for (BalanceOperationEnum value : values()) {
            if (value.operation.equals(operation)){
                return value;
            }
        }

        throw new RuntimeException("不存在该操作");
    }
}
